feat: Add NOT_GIVEN sentinel for nullable optional params - #694
Conversation
Adds the NotGiven type and NOT_GIVEN sentinel to the hand-maintained _types module. Generated methods use it as the default for nullable optional params so an omitted argument (leave unchanged) is distinguishable from an explicit None (clear via JSON null). The generated signatures arrive via regeneration from oagen-emitters#189.
Original prompt from heather
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Description
Hand-maintained runtime half of the cross-SDK nullable-clearing feature. Touches only the
@oagen-ignore-filesrc/workos/_types.py(plus a test), so it won't be auto-closed byworkos-sdk-automation.Adds a
NotGiventype andNOT_GIVENsentinel:Generated methods use
NOT_GIVENas the default for nullable optional params (e.g.external_id: Union[str, None, NotGiven] = NOT_GIVEN), so an omitted argument ("leave unchanged", filtered out) is distinguishable from an explicitNone("clear", sent as JSONnull). The base client already passes the built dict straight to httpx without a secondNone-strip, soNonereaches the wire asnull.The generated signatures/body logic come from regeneration against workos/oagen-emitters#189; this PR is the runtime prerequisite and is inert on its own.
Part of the cross-SDK effort (Ruby workos/workos-ruby#522).
Testing
Added
tests/test_types.pycovering the sentinel's falsiness, repr, and distinctness fromNone.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
Link to Devin session: https://app.devin.ai/sessions/127c630f46c54bc0be571814c75047e8